package me.work.pay.jsyl.mvp.model.entity;

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import java.util.ArrayList;

public class SelectDeviceEntity implements Parcelable {
    public ArrayList<Bean> cash;
    public ArrayList<Bean> horn;
    public ArrayList<Bean> printing;

    public static class Bean implements Parcelable,Comparable<Bean> {
        /**
         * id : xxx
         * brand_type : cash
         * brand_type_str : 收银机
         * brand_name : 微收银
         * brand_desc : 微收银
         * brand_id : 12312123123（微收银ID）
         * logo : http:,brand_desc:相关设备描述
         * software_type : easy（hard）
         * software_type_str : 软件(硬件)
         * insert_time : 添加时间
         */

        public String id;
        public String brand_type_str;
        public String brand_type;
        public String logo;
        public String software_type;
        public String software_type_str;
        public String insert_time;

        public String brand_name;
        public String brand_desc;
        public String brand_id;



        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.brand_type);
            dest.writeString(this.brand_type_str);
            dest.writeString(this.brand_name);
            dest.writeString(this.brand_desc);
            dest.writeString(this.brand_id);
            dest.writeString(this.logo);
            dest.writeString(this.software_type);
            dest.writeString(this.software_type_str);
            dest.writeString(this.insert_time);
        }

        public Bean() {
        }

        protected Bean(Parcel in) {
            this.id = in.readString();
            this.brand_type = in.readString();
            this.brand_type_str = in.readString();
            this.brand_name = in.readString();
            this.brand_desc = in.readString();
            this.brand_id = in.readString();
            this.logo = in.readString();
            this.software_type = in.readString();
            this.software_type_str = in.readString();
            this.insert_time = in.readString();
        }

        public static final Creator<Bean> CREATOR = new Creator<Bean>() {
            @Override
            public Bean createFromParcel(Parcel source) {
                return new Bean(source);
            }

            @Override
            public Bean[] newArray(int size) {
                return new Bean[size];
            }
        };

        @Override
        public int compareTo(@NonNull Bean bean) {
            return Integer.parseInt(this.id)-Integer.parseInt(bean.id);
        }
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeTypedList(this.cash);
        dest.writeTypedList(this.horn);
        dest.writeTypedList(this.printing);
    }

    public SelectDeviceEntity() {
    }

    protected SelectDeviceEntity(Parcel in) {
        this.cash = in.createTypedArrayList(Bean.CREATOR);
        this.horn = in.createTypedArrayList(Bean.CREATOR);
        this.printing = in.createTypedArrayList(Bean.CREATOR);
    }

    public static final Parcelable.Creator<SelectDeviceEntity> CREATOR = new Parcelable.Creator<SelectDeviceEntity>() {
        @Override
        public SelectDeviceEntity createFromParcel(Parcel source) {
            return new SelectDeviceEntity(source);
        }

        @Override
        public SelectDeviceEntity[] newArray(int size) {
            return new SelectDeviceEntity[size];
        }
    };
}
